package com.umakr.ax.sv.web;

import com.umakr.ax.sv.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.text.ParseException;

/**
 * Created by umakr on 2017/6/17.
 */
@RestController("/")
public class AppController {

    @Autowired
    AppService appService;

    @RequestMapping(value = "upload/{id}/{radioName}/{fileSuffix}/{audioLength}",method = RequestMethod.POST)
    @ResponseBody
    public Object upload(@PathVariable("id") Integer id,
                         @PathVariable("radioName") String radioName,
                         @PathVariable("fileSuffix") String fileSuffix,
                         @PathVariable("audioLength") Integer audioLength,
                         MultipartFile file){

        return appService.upload(id,radioName,fileSuffix,audioLength,file);
    }

    @RequestMapping("getRadioPage")
    public Object getRadioPage( Integer messagestatus){
        return appService.getRadioPage(messagestatus);
    }

    @RequestMapping("getCurrentRadioCount")
    @ResponseBody
    public Object getCurrentRadioCount( Integer messagestatus){
        return appService.getCurrentRadioCount(messagestatus);
    }

    @RequestMapping("getMessageStatusCount")
    @ResponseBody
    public Object getMessageStatusCount(){
        return appService.getMessageStatusCount();
    }

    @RequestMapping("getHistoryRadioPage")
    public Object getHistoryRadioPage( Integer filestatus){
        return appService.getHistoryRadioPage(filestatus);
    }

    @RequestMapping("getMessages")
    public Object getMessages(String membername,String createtimebegin,String createtimeend,String message,String category,Integer messagestatus) throws ParseException {
        return appService.getMessages(membername,createtimebegin, createtimeend, message, category, messagestatus);
    }

    @RequestMapping("changeMessageStatus")
    public Object changeMessageStatus( Long id,Integer status){
        return appService.changeMessageStatus(id ,status);
    }

    @RequestMapping("changeFileStatus")
    public Object changeFileStatus( Long id){
        return appService.changeFileStatus(id);
    }

    //批量审核
    @RequestMapping("changeMultstatus")
    public Object changeMultstatus(Integer[] id){
        return appService.changeMultstatus(id);
    }

    //一键归档
    @RequestMapping("changeMultfilestatus")
    public Object changeMultfilestatus(Integer[] id){
        return appService.changeMultfilestatus(id);
    }

    @RequestMapping("xunfeiTranslate")
    public Object xunfeiTranslate( Long id,String file){
        return appService.xunfeiTranslate(id,file);
    }
}
